package com.zmn.oms.common.enums;

import com.zmn.consts.DictModel;
import com.zmn.oms.common.constant.ConfRedistributeConsts;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 类描述: 改派审核人类型 枚举类
 *
 * @author: liudi
 * @since: 2022/05/06 20:26
 */
@AllArgsConstructor
@Getter
public enum ConfRedistributeAuditTypeEnum {

	/**
	 * 无需审核
	 */
	NONE(ConfRedistributeConsts.AUDIT_TYPE_NONE, "无需审核"),

	/**
	 * 工程师主管审核
	 */
	MANAGER(ConfRedistributeConsts.AUDIT_TYPE_MANAGER, "工程师主管审核"),

	/**
	 * 员工审核
	 */
	STAFF(ConfRedistributeConsts.AUDIT_TYPE_STAFF, "员工审核");

	private Integer type;
	private String name;


	/**
	 * 审核人类型列表
	 *
	 * @return
	 */
	public static List<DictModel> getAuditTypeList() {
		List<DictModel> items = new ArrayList<>(3);
		items.add(new DictModel(ConfRedistributeConsts.AUDIT_TYPE_NONE, "无需审核"));
		items.add(new DictModel(ConfRedistributeConsts.AUDIT_TYPE_MANAGER, "工程师主管审核"));
		items.add(new DictModel(ConfRedistributeConsts.AUDIT_TYPE_STAFF, "员工审核"));
		return items;
	}

	/**
	 * 根据 审核人类型 查询名称
	 *
	 * @param type
	 * @return
	 */
	public static String getNameByType(int type) {
		for (ConfRedistributeAuditTypeEnum confRedistributeAuditTypeEnum : ConfRedistributeAuditTypeEnum.values()) {
			if (confRedistributeAuditTypeEnum.getType() == type) {
				return confRedistributeAuditTypeEnum.getName();
			}
		}
		return "";
	}
}
